package com.hongdee.scm.inventory.service.impl;

import com.hongdee.common.dao.IImpHibernateDao;
import com.hongdee.common.dao.IImpJdbcDao;
import com.hongdee.common.util.TokenUtil;
import com.hongdee.scm.car.service.ITScmCarService;
import com.hongdee.scm.common.service.impl.Common;
import com.hongdee.scm.inventory.dao.ITScmInventoryDao;
import com.hongdee.scm.inventory.entity.TScmInventory;
import com.hongdee.scm.inventory.entity.TScmInventoryDetail;
import com.hongdee.scm.inventory.service.ITScmInventoryService;
import com.hongdee.scm.stock.entity.TScmStock;
import org.apache.poi.hssf.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import javax.swing.*;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * 名  称:TScmInventoryServiceImpl
 * 类  型:class
 * 描  述:
 * 路  径:com.hongdee.scm.inventory.service.impl
 * 作  者: 术洪超
 * 日  期:2017-06-01 14:42
 */
@Service
public class TScmInventoryServiceImpl implements ITScmInventoryService {

    String tabName = "T_SCM_INVENTORY";
    String entityName = "TScmInventory";

    @Autowired
    private ITScmInventoryDao itScmInventoryDao;
    @Autowired
    private IImpJdbcDao impJdbcDao;
    @Autowired
    private IImpHibernateDao iImpHibernateDao;


    @Override
    public Map info(String id) throws Exception {
        List param = new ArrayList();
        String sql = "select * from " + tabName + " where id = ?";
        param.add(id);
        return this.itScmInventoryDao.info(sql, param.toArray());
    }

//    @Override
//    public TScmInventory saveOrUpdate(TScmInventory data, String uid) throws Exception {
//        if (data.getId() == null) {
//            data.setTaskStatus("0");
//            data.setCreateTime(Calendar.getInstance().getTimeInMillis());
//            data.setCreateUser(uid);
//            data.setInventoryDate("");
//        } else {
//            data.setUpdateUser(uid);
//            data.setUpdateTime(Calendar.getInstance().getTimeInMillis());
//            if (data.getResultReason() != null && !StringUtils.isEmpty(data.getResultReason())) {
//                data.setTaskStatus("1");
//            }
//        }
//        data.setCompanyId(TokenUtil.getCompanyId(uid));
//        this.itScmInventoryDao.saveOrUpdate(data);
//        return data;
//    }

    @Override
    public TScmInventory saveOrUpdate(Map data, String uid) throws Exception {

        TScmInventory tScmInventory = new TScmInventory();

        if (data.get("id") == null || StringUtils.isEmpty(data.get("id")) || data.get("id").equals("")) {

            if(data.get("taskName")==null||StringUtils.isEmpty(data.get("taskName"))||data.get("taskName").equals("")){
                throw new Exception("任务名称不能为空!");
            }
            if(data.get("carCount")==null||StringUtils.isEmpty(data.get("carCount"))||data.get("carCount").equals("")){
                throw new Exception("盘点车辆总数不能为空!");
            }
            if(data.get("locationId")==null||StringUtils.isEmpty(data.get("locationId"))||data.get("locationId").equals("")){
                throw new Exception("单位不能为空!");
            }
            if(this.itScmInventoryDao.info("select * from t_scm_inventory where task_name = ? and company_id =?",data.get("taskName"),TokenUtil.getCompanyId(uid)).size()>0){
                throw new Exception("该任务名称已存在");
            }
            tScmInventory.setTaskStatus("0");
            tScmInventory.setMakeResult("0");
            tScmInventory.setCreateUser(uid);
            tScmInventory.setCreateTime(Calendar.getInstance().getTimeInMillis());
            tScmInventory.setInventoryDate("");
        } else {
            tScmInventory.setUpdateUser(uid);
            tScmInventory.setInventoryDate(data.get("inventoryDate").toString());
            tScmInventory.setUpdateTime(Calendar.getInstance().getTimeInMillis());
            // tScmInventory.setTaskStatus("1");
            if ((data.get("resultReason") != null && !StringUtils.isEmpty(data.get("resultReason"))) && data.get("result") != null && !StringUtils.isEmpty(data.get("result"))) {
                tScmInventory.setTaskStatus("1");

            }
            tScmInventory.setResult(data.get("result").toString());
            tScmInventory.setResultReason(data.get("resultReason").toString());
        }

        String locationStr = "";
        locationStr = data.get("locationId").toString().replace("[", "").replace("]", "");
        tScmInventory.setLocationId(locationStr);
        if(this.itScmInventoryDao.info("select * from t_scm_warehouse where id=? and company_id=?",data.get("locationId"),TokenUtil.getCompanyId(uid)).size()>0){
            tScmInventory.setWarehouseId(locationStr);
        }
        tScmInventory.setTaskName(data.get("taskName").toString());
        tScmInventory.setCarCount(data.get("carCount").toString());
        tScmInventory.setCompanyId(TokenUtil.getCompanyId(uid));
        this.itScmInventoryDao.saveOrUpdate(tScmInventory);
        if(tScmInventory.getWarehouseId()!=null&&!tScmInventory.getWarehouseId().equals("")){//仓库
            this.itScmInventoryDao.executeSQL("insert into t_scm_inventory_detail(id,create_time,create_user,car_model,company_id,configure_name,inventory_id,vin,warehouse) " +
                    "select uuid(),t.create_time,t.create_user,t.car_model,t.company_id,t.configure_name,t.inventory_id,t.vin,t.warehouse_name from ( " +
                    "select s.vin,c.car_model car_model,s.company_id,c.configure configure_name,i.create_time,i.create_user,i.id inventory_id,w.warehouse_name  " +
                    "from t_scm_stock s left join t_scm_car c on c.vin = s.vin inner join t_scm_warehouse w on s.warehouse_id = w.id,t_scm_inventory i " +
                    "where i.id=? and s.warehouse_id =?) t",tScmInventory.getId(),tScmInventory.getWarehouseId());
        }else{//公司
            this.itScmInventoryDao.executeSQL("insert into t_scm_inventory_detail(id,create_time,create_user,car_model,company_id,configure_name,inventory_id,vin,warehouse) " +
                    "select uuid(),t.create_time,t.create_user,t.car_model,t.company_id,t.configure_name,t.inventory_id,t.vin,t.warehouse_name from ( " +
                    "select s.vin,c.car_model car_model,s.company_id,c.configure configure_name,i.create_time,i.create_user,i.id inventory_id,w.warehouse_name " +
                    "from t_scm_stock s left join t_scm_car c on c.vin = s.vin inner join t_scm_warehouse w on s.warehouse_id = w.id,t_scm_inventory i " +
                    "where i.id=? and s.company_id =?) t",tScmInventory.getId(),TokenUtil.getCompanyId(uid));
        }
        return tScmInventory;
    }

    @Override
    public void update(Map data, String uid) throws Exception {

        String taskName = this.itScmInventoryDao.info("select * from t_scm_inventory where id=?",data.get("id")).get("taskName").toString();
        Boolean flag = true;
        StringBuffer sql = new StringBuffer();
        String carCount  = "0";
        String str = "";
        try{
            str = taskName.substring(0,6);
        }catch (Exception e){
            flag = false;
        }
        if(flag){
            List  list = this.itScmInventoryDao.list("select * from t_scm_monthlybalance where monthly_balance_month =? and company_id=? ",str,TokenUtil.getCompanyId(uid));
            Map map = (Map) list.get(0);
            if(!"3".equals(map.get("monthlyBalanceStatus"))&&!"2".equals(map.get("monthlyBalanceStatus"))){
                throw new Exception("先申请该月月结!");
            }
        }

        if(data.get("carCount")!=null){
            carCount = data.get("carCount").toString();
        }
        sql.append("update t_scm_inventory set car_count = '"
                + carCount + "', make_result = '1',result = '" + data.get("result")
                + "',result_reason= '" + data.get("resultReason") + "',task_status = '1', inventory_date = '"
                + data.get("inventoryDate") + "', location_id = '" + data.get("locationId") + "' where id = '"
                + data.get("id") + "'");
        this.itScmInventoryDao.executeSQL(sql.toString());
    }


    @Override
    public void print(String id) throws Exception {

        String hql = "update " + tabName + " set inventoryOrderStatus = '1' where id = :id";
        Map params = new HashMap();
        params.put("id", id);
        this.itScmInventoryDao.update(hql, params);

    }

    /**
     * 车辆列表查询
     *
     * @param uid
     * @param data
     * @return
     * @throws Exception
     */
    @Override
    public Map page(String start, String limit, Map data, String uid) throws Exception {

        List params = new ArrayList();
        String sql = "select i.*,locationName(i.location_id) locationName from t_scm_inventory i where i.company_id=?";
        params.add(TokenUtil.getCompanyId(uid));

        if (data.get("startDate") != null && !data.get("startDate").equals("")) {
            sql += " and i.inventory_date >= ?";
            params.add(data.get("startDate"));
        }

        if (data.get("stopDate") != null && !data.get("stopDate").equals("")) {
            sql += " and i.inventory_date <= ?";
            params.add(data.get("stopDate"));
        }

        if (data.get("warehouse") != null && !data.get("warehouse").equals("")) {
            sql += " and i.warehouse_id = ?";
            params.add(data.get("warehouse"));

        }
        if (data.get("result") != null && !data.get("result").equals("")) {
            sql += " and i.result = ?";
            params.add(data.get("result"));
        }
        sql += " order by i.create_time desc";
        return this.itScmInventoryDao.page(sql, params.toArray(), start, limit);
    }


    /**
     * 车辆列表查询
     *
     * @param uid
     * @param data
     * @return
     * @throws Exception
     */
    @Override
    public Map carPage(String start, String limit, Map data, String uid, String warehouseId) throws Exception {

        List params = new ArrayList();
        StringBuffer sqlbuf = new StringBuffer();
        sqlbuf.append("select * from t_scm_inventory_detail d where d.inventory_id = ? ");
        params.add(data.get("inventoryId"));

        //vin条件模糊
        if (data.get("vin") != null && !data.get("vin").toString().equals("")) {
            sqlbuf.append(" and d.vin like ? ");
            params.add("%" + data.get("vin") + "%");
        }
        //车型
        if (data.get("carModel") != null && !data.get("carModel").toString().equals("")) {
            sqlbuf.append(" and d.car_model = ? ");
            params.add(data.get("carModel"));
        }
        sqlbuf.append(" order by warehouse,d.difference_type ");
        return this.itScmInventoryDao.page(sqlbuf.toString(), params.toArray(), start, limit);
    }

    @Override
    public Map carCount(String locationId, String uid) throws Exception {

        List params = new ArrayList();
        StringBuffer sql = new StringBuffer();
        sql.append("select count(1) as carCount from t_scm_stock ");
        if (!StringUtils.isEmpty(locationId)) {
            sql.append(" where warehouse_id = ? or company_id = ?");
            params.add(locationId);
            params.add(locationId);
        }
        return this.itScmInventoryDao.info(sql.toString(), params.toArray());
    }

//
//    @Override
//    public Map companyCarCount(String companyId, String uid) throws Exception {
//
//        List params = new ArrayList();
//        StringBuffer sql = new StringBuffer();
//        sql.append("select count(*) as carCount from t_scm_stock");
//
//        if (!StringUtils.isEmpty(companyId)) {
//            sql.append(" where company_id = ?");
//            params.add(companyId);
//        }
//        return this.itScmInventoryDao.info(sql.toString(), params.toArray());
//    }

    @Override
    public List<Map<String,Object>> findExcel( String uid,  String warehouseId,Map data) throws Exception {
        List params = new ArrayList();
        Common com = new Common();
        Boolean hasWhere = false;
        StringBuffer sqlbuf = new StringBuffer();
        sqlbuf.append("select s.vin,s.difference_reason,s.appearance_name,s.engine_num,s.enter_date,w.warehouse_name,o.o_name as companyName," +
                "cs.car_series_name as carSeries,cm.model_name as carModel,cc.configure_name,s.difference_type,w.warehouse_name " +
                "from t_scm_stock s LEFT JOIN t_scm_warehouse w on s.warehouse_id = w.id " +
                "left JOIN t_bc_organ o on o.id = s.company_id left join t_bc_car_series cs on cs.id = s.car_series " +
                "LEFT JOIN t_bc_carmodel cm on cm.id = s.car_model left join t_bc_carconfigure cc on cc.id = s.configure_name  ");
        String cid = TokenUtil.getCompanyId(uid);
        if(cid!=null&&!cid.equals("")){
            hasWhere = com.appendWhereIfNeed(sqlbuf, hasWhere);
            sqlbuf.append(" s.company_id = ? ");
            params.add(cid);
        }
        //仓库ID
        if (!StringUtils.isEmpty(warehouseId)) {
            hasWhere = com.appendWhereIfNeed(sqlbuf, hasWhere);
            sqlbuf.append(" s.warehouse_id = ? ");
            params.add(warehouseId);
        }
        //vin条件模糊
        if (data.get("vin") != null && !data.get("vin").toString().equals("")) {
            hasWhere = com.appendWhereIfNeed(sqlbuf, hasWhere);
            sqlbuf.append(" s.vin like ? ");
            params.add("%" + data.get("vin") + "%");
        }
        //车型
        if (data.get("carModel") != null && !data.get("carModel").toString().equals("")) {
            hasWhere = com.appendWhereIfNeed(sqlbuf, hasWhere);
            sqlbuf.append(" s.car_model = ? ");
            params.add(data.get("carModel"));
        }
        hasWhere = com.appendWhereIfNeed(sqlbuf, hasWhere);
        sqlbuf.append(" s.vin not in (select d.vin from T_Scm_inventory_detail d) ");
        sqlbuf.append(" order by s.enter_date");
        List<Map<String,Object>> list=this.itScmInventoryDao.list(sqlbuf.toString(), params.toArray());
        return list;
    }
    @Override
    public HSSFWorkbook export(List<Map<String,Object>> lists, String uid) throws Exception{
        System.out.print("@@@@"+lists.size());
        String[] excelHeaderCoupon = {"VIN", "车型", "配置", "盘点差异类型", "差异原因","仓库名称"};
        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sheet = wb.createSheet("库存盘点");
        HSSFRow row = sheet.createRow((int) 0);
        HSSFCellStyle style = wb.createCellStyle();
        style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
        for (int i = 0; i < excelHeaderCoupon.length; i++) {
            HSSFCell cell = row.createCell(i);
            cell.setCellValue(excelHeaderCoupon[i]);
            cell.setCellStyle(style);
            sheet.autoSizeColumn(i);

            sheet.setDefaultRowHeightInPoints(10);//设置缺省列高sheet.setDefaultColumnWidth(20);//设置缺省列宽

            //设置指定列的列宽，256 * 30这种写法是因为width参数单位是单个字符的256分之一

            sheet.setColumnWidth(cell.getColumnIndex(), 256 * 30);
        }

        for (int i = 0; i < lists.size(); i++){
            System.out.print("&&&&"+lists.size());
            Map map=lists.get(i);
            row = sheet.createRow(i + 1);

            System.out.print("*************"+map+"************************/n");
            System.out.print("qqqq"+map.get("vin"));
            if(map.get("vin")==null){
                row.createCell(0).setCellValue("暂无");
            }else{
                row.createCell(0).setCellValue(String.valueOf(map.get("vin")));
            }

            System.out.print("++++++++"+map.get("carModel")+"++++++++/");
            if(map.get("carModel")==null){
                row.createCell(1).setCellValue("暂无");
            }else{
                row.createCell(1).setCellValue(String.valueOf(map.get("carModel")));
            }

            if(map.get("configureName")==null){
                row.createCell(2).setCellValue("暂无");
            }else{
                row.createCell(2).setCellValue(String.valueOf(map.get("configureName")));
            }

            if(map.get("differenceType")==null){
                row.createCell(3).setCellValue("暂无");
            }else{
                row.createCell(3).setCellValue(String.valueOf(map.get("differenceType")));
            }

            if(map.get("differenceReason")==null){
                row.createCell(4).setCellValue("暂无");
            }else{
                row.createCell(4).setCellValue(String.valueOf(map.get("differenceReason")));
            }
            if(map.get("warehouse")==null){
                row.createCell(5).setCellValue("暂无");
            }else{
                row.createCell(5).setCellValue(String.valueOf(map.get("warehouse")));
            }
        }
        return wb;
    }

    String[] excelHeader = {"VIN", "车型名称", "配置名称","仓库名称"};
    @Override
    public HSSFWorkbook exportCar(List<TScmInventoryDetail> list, String uid) throws Exception{

        HSSFWorkbook wb = new HSSFWorkbook();
        HSSFSheet sheet = wb.createSheet("盘点车辆");


        HSSFRow row = sheet.createRow((int) 0);
        HSSFCellStyle style = wb.createCellStyle();
        style.setAlignment(HSSFCellStyle.ALIGN_CENTER);

        for (int i = 0; i < excelHeader.length; i++) {
            HSSFCell cell = row.createCell(i);
            cell.setCellValue(excelHeader[i]);
            cell.setCellStyle(style);
            sheet.autoSizeColumn(i);

            sheet.setDefaultRowHeightInPoints(10);//设置缺省列高sheet.setDefaultColumnWidth(20);//设置缺省列宽

            //设置指定列的列宽，256 * 30这种写法是因为width参数单位是单个字符的256分之一

            sheet.setColumnWidth(cell.getColumnIndex(), 256 * 30);
        }

        for (int i = 0; i < list.size(); i++) {

            TScmInventoryDetail tScmInventoryDetail = list.get(i);
            row = sheet.createRow(i + 1);
            row.createCell(0).setCellValue(tScmInventoryDetail.getVin());
            if(tScmInventoryDetail.getCarModel()!=null&&!tScmInventoryDetail.getCarModel().equals("")){
                row.createCell(1).setCellValue(tScmInventoryDetail.getCarModel());
            }
            if(tScmInventoryDetail.getConfigureName()!=null&&!tScmInventoryDetail.getConfigureName().equals("")){
                row.createCell(2).setCellValue(tScmInventoryDetail.getConfigureName());
            }
            if(tScmInventoryDetail.getWarehouse()!=null&&!tScmInventoryDetail.getWarehouse().equals("")){
                row.createCell(3).setCellValue(tScmInventoryDetail.getWarehouse());
            }
        }
        return wb;
    }

    /**
     * 把当月的车辆导出来
     * @param uid
     * @param inventoryId
     * @return
     * @throws Exception
     */
    @Override
    public List<TScmInventoryDetail> findList(String uid,String inventoryId) throws Exception{

        List params = new ArrayList();
        String sql = "select * from t_scm_inventory_detail where inventory_id = ?";
        params.add(inventoryId);

        List<Map<String, Object>> list1 = this.itScmInventoryDao.list(sql, params.toArray());
        List<TScmInventoryDetail> tScmInventoryDetails = new ArrayList<>();

        for (Map map : list1) {
            TScmInventoryDetail tt = new TScmInventoryDetail();
            if((map.get("vin")!=null&&!map.get("vin").equals(""))){
                tt.setVin(map.get("vin").toString());
            }else{
                continue;
            }
            if(map.get("carModel")!=null&&!map.get("carModel").equals("")){
                tt.setCarModel(map.get("carModel").toString());
            }
            if(map.get("configureName")!=null&&!map.get("configureName").equals("")){
                tt.setConfigureName(map.get("configureName").toString());
            }
            if (map.get("warehouse")!=null&&!map.get("warehouse").equals("")) {
                tt.setWarehouse(map.get("warehouse").toString());
            }
            tScmInventoryDetails.add(tt);
        }
        return tScmInventoryDetails;
    }

    /**
     * 盘点导入
     * @param uid
     * @param inventoryId
     * @throws Exception
     */
    @Override
    public void importCar(String uid,String inventoryId) throws Exception{

        String cid = TokenUtil.getCompanyId(uid);
        Map map = new HashMap();
        String hql = " delete from TScmInventoryDetail where companyId =:companyId";
        map.put("companyId", cid);

        StringBuffer sqlBuffer = new StringBuffer();
        sqlBuffer.append("select * from t_scm_inventory_detail");
        List<String> paramList = new ArrayList<String>();
        Common common = new Common();
        Boolean hasWhere = false;

        String name = this.getLoginName(uid);
        String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
        if(!cid.isEmpty()){
            hasWhere = common.appendWhereIfNeed(sqlBuffer, hasWhere);
            sqlBuffer.append(" company_id =? ");
            paramList.add(cid);
        }
        sqlBuffer.append(" order by vin desc");
        Map maps =  this.impJdbcDao.queryForPageMap("0", "100000", sqlBuffer.toString(), paramList.toArray());
        List<Map<String, Object>> list = (List) maps.get("dataList");
        for(Map<String,Object> m : list){
            //去掉vin前后空格
            String vin = m.get("vin").toString().trim();
            if(vin.length()!=17){

                //删除第二数据库t_scm_inventory_detail表中的数据
                this.iImpHibernateDao.executeHqlWithParams(hql, map);
                throw new Exception(vin+"是不正确的车架号");
            }
            Map mm = this.itScmInventoryDao.info("select * from t_scm_inventory_detail where vin = ? and inventory_id = ? and company_id=?",vin,inventoryId,cid);
            if(mm.size()>0){
                 if(mm.get("resultReason")==null||mm.get("resultReason").toString().equals("")){
                     this.itScmInventoryDao.executeSQL("update t_scm_inventory_detail set difference_type ='正常',result_reason='导入校对',inventory_person=?,inventory_time=? where vin =? and company_id=?",name,time,vin,cid);
                 }
            }else{
                this.itScmInventoryDao.executeSQL("insert into t_scm_inventory_detail(id,vin,inventory_id,result_reason,inventory_person,inventory_time,company_id,difference_type) values(uuid(),?,?,'导入盘盈',?,?,?,'盘盈')",vin,inventoryId,name,time,cid);
            }
        }
        //删除第二数据库t_scm_inventory_detail表中的数据
        this.iImpHibernateDao.executeHqlWithParams(hql, map);
    }

    /**
     * 手动输入盘点整正常
     * @param data
     * @throws Exception
     */
    @Override
    public void updateRight(Map data,String uid) throws Exception{

        String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
        List<String> list = (List<String>) data.get("vin");
        List<String> vinList = new ArrayList();
        for (String vin : list) {
            vinList.add(vin);
        }
        Map param = new HashMap();
        StringBuffer hql = new StringBuffer();
        hql.append("update TScmInventoryDetail set differenceType = '正常', resultReason = '手动输入'," +
                "inventoryPerson=:inventoryPerson,inventoryTime=:inventoryTime where inventoryId=:inventoryId and companyId=:companyId and ");
        hql.append(" vin in (:vinList)  ");
        param.put("inventoryPerson",this.getLoginName(uid));
        param.put("inventoryTime",time);
        param.put("inventoryId",data.get("inventoryId"));
        param.put("companyId",TokenUtil.getCompanyId(uid));
        param.put("vinList", vinList);

        this.itScmInventoryDao.update(hql.toString(), param);

    }

    /**
     * 手动输入盘亏
     * @param data
     * @throws Exception
     */
    @Override
    public void updateError(Map data,String uid) throws Exception{

        String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
        List<String> list = (List<String>) data.get("vin");
        List<String> vinList = new ArrayList();
        List<String> reasonList = new ArrayList<>();
        for (String vin : list) {
            vinList.add(vin);
        }
        Map params = new HashMap();
        StringBuffer hqls = new StringBuffer();
        hqls.append("update TScmInventoryDetail set differenceType = '盘亏',resultReason = :reason,inventoryPerson=:inventoryPerson,inventoryTime=:inventoryTime" +
                 " where inventoryId=:inventoryId and companyId=:companyId and ");
        hqls.append(" vin in (:vinList)  ");
        params.put("reason",data.get("reason"));
        params.put("inventoryPerson",this.getLoginName(uid));
        params.put("inventoryTime",time);
        params.put("inventoryId",data.get("inventoryId"));
        params.put("companyId",TokenUtil.getCompanyId(uid));
        params.put("vinList", vinList);
        this.itScmInventoryDao.update(hqls.toString(), params);
    }

    /**
     * 获取登录人姓名
     * @param uid
     * @return
     * @throws Exception
     */
    @Override
    public String getLoginName(String uid) throws Exception{
        return this.itScmInventoryDao.info("select * from t_bc_user where id =?",uid).get("uName").toString();
    }

    /**
     * 盘点确认
     * @param inventoryId
     * @param uid
     * @throws Exception
     */
    @Override
    public void confirmInventory(String inventoryId,String uid) throws Exception{

        this.itScmInventoryDao.executeSQL("update t_scm_inventory set make_result ='1',task_status='1' where id = ? and company_id=?",inventoryId,TokenUtil.getCompanyId(uid));
    }
}
